package com.coocaa.ops.admin.v1.panel.convert;

import com.coocaa.ops.common.core.biz.panel.entity.BlockContentConfigInfo;
import com.coocaa.ops.common.core.biz.panel.entity.PanelRecStreamFixedContentInfo;
import org.apache.commons.collections4.CollectionUtils;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @author tangminghong
 * @date 2020-07-28
 */
public class RecStreamPanelQueryConverter {

    public static List<PanelRecStreamFixedContentInfo> getFixedContentList(List<BlockContentConfigInfo> blockList) {
        if (CollectionUtils.isEmpty(blockList)) {
            return Collections.emptyList();
        }
        List<PanelRecStreamFixedContentInfo> fixedContentInfoList = new ArrayList<>(blockList.size());
        for (BlockContentConfigInfo block : blockList) {
            PanelRecStreamFixedContentInfo fixedContentInfo = new PanelRecStreamFixedContentInfo();
            fixedContentInfo.setContent(block);
            fixedContentInfo.setSeq(block.getBlockSeq());
            fixedContentInfoList.add(fixedContentInfo);
        }
        return fixedContentInfoList;
    }
}
